﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;


namespace Raw1
{
    public abstract class Monitor : IMonitor
    {
        public abstract Monitors MonitorType { get; set; }
        public virtual event EventHandler MonitorChangedEvent;

        //The event-invoking method that derived classes can override. 
        protected virtual void OnChanged(EventArgs e)
        {
            // Make a temporary copy of the event to avoid possibility of 
            // a race condition if the last subscriber unsubscribes 
            // immediately after the null check and before the event is raised.
            EventHandler handler = MonitorChangedEvent;
            if (handler != null)
            {
                handler(this, e);
            }
        }

        public abstract void RunWatcher();
        

    }
}
